package com.jtpay.sth0409.patternlockdemo.Util;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by XiaoMieMie on 2017/03/28-13:40.
 */

public class SPUtils {

    private static SharedPreferences preferences;
    private SharedPreferences.Editor editor;

    private SPUtils() {
    }

    public static SPUtils getInstance(Context context) {
        preferences = context.getSharedPreferences("patternLockDemo", Context.MODE_PRIVATE);

        return new SPUtils();
    }

    public void setPattern(String Key, String value) {
        editor = preferences.edit();
        editor.putString(Key, value);
        editor.commit();
    }


    public String getPattern(String Key){

        return preferences.getString(Key,"");
    }
    public void clearPattern(){

        preferences.edit().clear().commit();
    }
}
